#include <iostream>
#include "complex0.h"

Complex::Complex()
{
	a = b = 0.0;
}

Complex::Complex(double num1, double num2)
{
	a = num1;
	b = num2;
}

Complex::~Complex()
{
	b = -b;
}

Complex Complex::operator+(const Complex num) const
{											  
	return Complex(a+num.a, b+num.b);		  
}											  
											  
Complex Complex::operator-(const Complex num) const
{
	return Complex(a - num.a, b - num.b);
}

Complex Complex::operator*(const Complex num) const
{
	return Complex(a * num.a - b * num.b, a * num.b + b * num.a);
}

Complex Complex::operator*(double num) 
{
	return Complex(a * num, b * num);
}

Complex operator*(double num, const Complex& b)
{
	return num * b;
}


std::ostream& operator<<(std::ostream& os, const Complex b)
{
	os << "( " << b.a << " + " << b.b << "! )";
	return os;
}

std::istream& operator>>(std::istream& in,  Complex num)
{
	in >> num.a >> num.b;
	return in;
}